import { AssetDisposeManageAPI } from '../common/type';
import { Button, Tooltip } from 'antd';
import { getColorTextLoadMap, removeDateHmsStr, tooltipLength } from '@/utils';
import pageStyles from '@/common/pageLayout.less';
import { stateOfRendering } from '../common';
import { ManageCommonAPI } from '@/pages/type';
import { tableMoreBtnConfig } from '@/utils/myutilConfig';
import { ColumnsRenderFun, DictionaryRenderFun, formatDecimal } from '../../../Assetmanagement/Acommon';

// Table表格的配置
const getTableColumns = (curRes: Record<string, any>) => {
  return [
    {
      title: '统计时间',
      dataIndex: 'time',
      key: 'time',
      width: 165,
      visible: true,
      unDrag: true,
      fixed: 'left',
      sorter: (a: any, b: any) => (a?.time > b?.time ? 1 : -1),
      render: (text: string | null) => ColumnsRenderFun({ text, wordNum: 100 }),
    },
    {
      title: '所属单位',
      dataIndex: 'company',
      key: 'company',
      width: 150,
      unDrag: true,
      visible: true,
      sorter: (a: any, b: any) => (a?.company > b?.company ? 1 : -1),
      render: (text: string) => {
        return (
          <Tooltip title={text}>
            <div className={pageStyles['over-flow-hidden']}>{text || '--'}</div>
          </Tooltip>
        );
      },
    },
    {
      title: '所属部门',
      dataIndex: 'bumen',
      key: 'bumen',
      width: 150,
      unDrag: true,
      visible: true,
      sorter: (a: any, b: any) => (a?.bumen > b?.bumen ? 1 : -1),
      render: (text: number) => {
        return (
          <Tooltip title={text}>
            <div className={pageStyles['over-flow-hidden']}>{text || '--'}</div>
          </Tooltip>
        );
      },
    },
    {
      title: '资产类型',
      dataIndex: 'assetType',
      key: 'assetType',
      width: 150,
      unDrag: true,
      visible: true,
      sorter: (a: any, b: any) => (a?.assetType > b?.assetType ? 1 : -1),
      render: (text: number) => {
        return (
          <Tooltip title={text}>
            <div className={pageStyles['over-flow-hidden']}>{text || '--'}</div>
          </Tooltip>
        );
      },
    },
    {
      title: '资产数目',
      dataIndex: 'count',
      key: 'count',
      width: 150,
      unDrag: true,
      visible: true,
      sorter: (a: any, b: any) => (a?.count > b?.count ? 1 : -1),
      render: (text: string) => {
        return (
          <Tooltip title={text}>
            <div className={pageStyles['over-flow-hidden']}>{text || '--'}</div>
          </Tooltip>
        );
      },
    },
    {
      title: '资产价值',
      dataIndex: 'price',
      key: 'price',
      width: 150,
      unDrag: true,
      visible: true,
      sorter: (a: any, b: any) => (a?.price > b?.price ? 1 : -1),
      render: (text: number) => {
        return (
          <Tooltip title={text}>
            <div className={pageStyles['over-flow-hidden']}>{text || '--'}</div>
          </Tooltip>
        );
      },
    },
  ];
};

export { getTableColumns };
